//---------------------------------------------------------------------------

#ifndef CustomerBridgeH
#define CustomerBridgeH

#include <dbtables.hpp>
#include "Sequence.h"

class TCustomerBridge
{
   public:
      TCustomerBridge( TDatabase * database);
      ~TCustomerBridge();
      __int64 GetLastID();
      __int64 GetNextID();
      void GetCheckings( __int64 id, TStrings * checkings);
      void Add( __int64 id, AnsiString customerID, AnsiString name, AnsiString lastName, AnsiString phone, AnsiString address, AnsiString email, TStrings * checkings);
      void Update( __int64 id, AnsiString customerID, AnsiString name, AnsiString lastName, AnsiString phone, AnsiString address, AnsiString email, TStrings * checkings);
      void Delete( __int64 id);

   private:
      TQuery * qryGetCheckings;
      TQuery * qryAdd;
      TQuery * qryAddChecking;
      TQuery * qryDelete;
      TQuery * qryDeleteChecking;

      TSequence * sequence;

      void BuildGetCheckingsQuery();
      void BuildAddQuery();
      void BuildDeleteQuery();
};

class TChecking : public TObject
{
   public:
      AnsiString left;
      AnsiString right;
      AnsiString remark;
      TDateTime  date;

      TChecking( AnsiString left, AnsiString right, AnsiString remark, TDateTime date);
};

//---------------------------------------------------------------------------
#endif
